<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<script type="text/javascript" src="<s:url value="/js/jquery/jquery.collapse.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery/jquery.blockUI.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/sitelevel.js"/>"></script>

<s:form action="changeSite" id="siteForm" cssStyle="width: 100%; text-align: center; margin-top: 20px;">
    <tr>
        <th colspan="2" class="tableTitle">
            <h5>Site Level Documents</h5>
        </th>
    </tr>

    <s:select list="sites"
              headerKey="-1" headerValue="Choose a Site"
              listKey="id" listValue="institucion"
              value="%{siteId}"
              name="siteId"
              onchange="checkBlockTable(this.value); $('#siteForm').submit()"/>
</s:form>
<s:url action="changeCategory" var="changeURL"/>

<s:if test="siteId != null && siteId > 0">
    <div id="table_content">
        <table>
            <thead class="paginated-table">
            <tr>
                <th>Category</th>
                <th>Name</th>
                <th>Version</th>
                <th>Comments</th>
                <th>Dated</th>
                <th>Received BMS</th>
                <th>Sent to site</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
                <s:iterator value="listProtocolInformation" var="documentation">
                    <s:include value="protocolinformation/ProtocolInformationTable.jsp"/>
                </s:iterator>

                <s:iterator value="listInformedConsents" >
                    <s:include value="informedconsents/InformedConsentsTable.jsp"/>
                </s:iterator>

                <s:iterator value="listPrintedMaterials" >
                    <s:include value="printedmaterials/PrintedMaterialsTable.jsp"/>
                </s:iterator>

                <s:iterator value="listDataSafety" >
                    <s:include value="datasafetymonitoring/DataSafetyMonitoringTable.jsp"/>
                </s:iterator>

                <s:iterator value="listReaprobaciones" >
                    <s:include value="reaprobaciones/ReaprobacionesTable.jsp"/>
                </s:iterator>

                <s:iterator value="listCtags" >
                    <s:include value="ctag/CtagTable.jsp"/>
                </s:iterator>

                <s:iterator value="listStudystaffs" >
                    <s:include value="studystaff/StudyStaffTable.jsp"/>
                </s:iterator>

                <s:iterator value="listStudydeviations" >
                    <s:include value="studydeviations/StudydeviationsTable.jsp"/>
                </s:iterator>

                <s:iterator value="listSuplementalcrfcsps" >
                    <s:include value="suplementalcrfcsp/SuplementalCrfcspTable.jsp"/>
                </s:iterator>

                <s:iterator value="listSaes" >
                    <s:include value="saes/SaesTable.jsp"/>
                </s:iterator>

                <s:iterator value="listAdvancedfinalstudyreports" >
                    <s:include value="advancedfinalstudyreports/AdvancedFinalTable.jsp"/>
                </s:iterator>

                <s:iterator value="listSecdiscrepancyreports" >
                    <s:include value="secdiscrepancyreport/SECDiscrepancyTable.jsp"/>
                </s:iterator>

                <s:include value="studystartup/StudyStartupTable.jsp"/>
                <s:include value="closure/ClosureDocumentsTable.jsp"/>

            <tbody>
        </table>
        <div style="width: 100%;text-align: center" >
            <span class="prev" style="" >Previous</span><span class="next">Next</span>
        </div>
        <script type="text/javascript">
            paginar(10);
        </script>
    </div>
</s:if>

<div id="filter"  class="tableFilter" >
    <s:form  id="formEdit" cssClass="tableFilter" cssStyle="width: 85%; table-layout:fixed">
        <s:hidden name="siteId" value="%{siteId}" id="siteHidden"/>
        <s:select label="Category" id="category"
                  list="categories"
                  onchange="changeCategory(this.value, '%{changeURL}', $('#siteHidden').val());inicializarTodaFecha()">
        </s:select>
        <s:include value="protocolinformation/ProtocolInformation.jsp"/>
    </s:form>

  </div>

<br/>

<script type="text/javascript">
    selectItemMenu("sld");
    $('#category').val(1);
    $(".checkboxLabel").each(function(index, value){
        var label = $(value).clone();
        $(value).parent().parent().children(':first-child').append(label);
        $(value).parent().parent().children(':first-child').removeAttr("valign align");
        $(value).parent().parent().children(':first-child').addClass("tdLabel");
        $(value).remove();
    });
</script>
<s:if test="siteId == null || siteId == -1">
    <script type="text/javascript">
        blockTable();
    </script>
</s:if>
